import {request} from 'umi';
import {MenuListItem, MenuListParams} from './data.d';

export async function queryMenuList(params?: MenuListParams) {
  return request('/api/tpl/menu/queryMenuList', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}


export async function removeMenu(id: number) {
  return request('/api/system/menu/delete', {
    method: 'POST',
    data: {
      id: id
    },
  });
}

export async function addMenu(params: MenuListItem) {
  return request('/api/system/menu/save', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function updateMenu(params: MenuListItem) {
  return request('/api/system/menu/update', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
